package cn.study.luckyapp.award.query;

import cn.study.luckyapp.assembler.AwardAssembler;
import cn.study.luckyclient.dto.data.AwardVo;
import cn.study.luckyclient.dto.query.AwardListByParamQuery;
import cn.study.luckydomain.award.AwardEntity;
import cn.study.luckydomain.gateway.AwardGateway;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@AllArgsConstructor
public class AwardListByParamQueryExe {
    private final AwardGateway awardGateway;
    public IPage<AwardVo> execute(AwardListByParamQuery query){
        IPage<AwardEntity> page = awardGateway.page(query);
        return page.convert(AwardAssembler::toAwardVo);
    }
}
